using AndroidCaller;
using System.Collections;
using UnityEngine;
using UnityEngine.SceneManagement;

public class LoadingStart : MonoBehaviour
{
    private void Start()
	{
        StartCoroutine(LoadAd(1f));
	}

	public void OpenAd()
	{
		//NativeCall.Call(string.Empty);
	}

	public void CloseAd()
	{
		StartCoroutine(LoadNextScene(1f));
	}

	private IEnumerator LoadAd(float seconds)
	{
		float pauseEndTime = Time.realtimeSinceStartup + seconds;
		while (Time.realtimeSinceStartup < pauseEndTime)
		{
			yield return 0;
		}
		OpenAd();
	}

	private IEnumerator LoadNextScene(float seconds)
	{
		float pauseEndTime = Time.realtimeSinceStartup + seconds;
		while (Time.realtimeSinceStartup < pauseEndTime)
		{
			yield return 0;
		}
		LoadScene();
	}

	public void LoadScene()
	{
		SceneManager.LoadScene("Menu");
    }
}
